options ls = 100 ps = 80 probsig=2;

data fuzzy1;  informat code $20.;informat bcode $20.;
   infile 'c:/My Documents/data/scAT.2/ASDoneIAT_exp2a.dat' delimiter='09'x;
   input date    time  $  build  sub   code    $   block   trial  lat     resp  $  corr  trialitm    bcode $;
data fuzzy2;  informat code $20.;informat bcode $20.;
   infile 'c:/My Documents/data/scAT.2/ASDoneIAT_exp2b.dat' delimiter='09'x;
   input date    time  $  build  sub   code    $   block   trial  lat     resp  $  corr  trialitm    bcode $;
data fuzzy3;  informat code $20.;informat bcode $20.;
   infile 'c:/My Documents/data/scAT.2/BSDoneIAT_exp2a.dat' delimiter='09'x;
   input date    time  $  build  sub   code    $   block   trial  lat     resp  $  corr  trialitm    bcode $;
data fuzzy4;  informat code $20.;informat bcode $20.;
   infile 'c:/My Documents/data/scAT.2/BSDoneIAT_exp2b.dat' delimiter='09'x;
   input date    time  $  build  sub   code    $   block   trial  lat     resp  $  corr  trialitm    bcode $;
data fuzzy5;  informat code $20.;informat bcode $20.;
   infile 'c:/My Documents/data/scAT.2/ESDoneIAT_exp2a.dat' delimiter='09'x;
   input date    time  $  build  sub   code    $   block   trial  lat     resp  $  corr  trialitm    bcode $;
data fuzzy6;  informat code $20.;informat bcode $20.;
   infile 'c:/My Documents/data/scAT.2/ESDoneIAT_exp2b.dat' delimiter='09'x;
   input date    time  $  build  sub   code    $   block   trial  lat     resp  $  corr  trialitm    bcode $;
data fuzzy7;  informat code $20.;informat bcode $20.;
   infile 'c:/My Documents/data/scAT.2/FSDoneIAT_exp2a.dat' delimiter='09'x;
   input date    time  $  build  sub   code    $   block   trial  lat     resp  $  corr  trialitm    bcode $;
data fuzzy8;  informat code $20.;informat bcode $20.;
   infile 'c:/My Documents/data/scAT.2/FSDoneIAT_exp2b.dat' delimiter='09'x;
   input date    time  $  build  sub   code    $   block   trial  lat     resp  $  corr  trialitm    bcode $;
data fuzzy9;  informat code $20.;informat bcode $20.;
   infile 'c:/My Documents/data/scAT.2/GSDoneIAT_exp2a.dat' delimiter='09'x;
   input date    time  $  build  sub   code    $   block   trial  lat     resp  $  corr  trialitm    bcode $;
data fuzzy10;  informat code $20.;informat bcode $20.;
   infile 'c:/My Documents/data/scAT.2/GSDoneIAT_exp2b.dat' delimiter='09'x;
   input date    time  $  build  sub   code    $   block   trial  lat     resp  $  corr  trialitm    bcode $;
data temp;
  set fuzzy1 fuzzy2 fuzzy3 fuzzy5 fuzzy6 fuzzy7 fuzzy8 fuzzy9 fuzzy10;

if block in (1,2) then delete;if trial < 19 then delete;if bcode = 'bcode' then delete;
/*if sub in (31) then delete;  */

if code in ( 'bugs_false833', 'fruit_false833', 'good_false833', 'bad_false833',
             'background_false833',
             'bugs_false666', 'fruit_false666', 'good_false666', 'bad_false666',
             'background_false666')
then item = 0;else item = 1;

if corr = 0 and item = 0 then response = 'corrrej';if corr = 0 and item = 1 then response = 'miss';
if corr = 1 and item = 0 then response = 'falsalr';if corr = 1 and item = 1 then response = 'hit';

proc means n mean std; class bcode; var lat; run;

proc sort; by sub bcode response; run;
proc means noprint data=temp n; by sub bcode response; var lat; output out=means  mean=speed; run;
proc transpose data=means prefix=speed name=name out=spdmeans; by sub bcode response;run;
proc sort; by name; run;
data prac;  set spdmeans; if name ^= '_FREQ_' then delete;
   /*if speed1 < 0 then speed1 = 0;*/
   if response = 'corrrej' then do;
      if speed1 = 20 then do; response = 'falsalr'; speed1 = 0.35; end;
      else delete; end;
   if response = 'miss' then do;
      if speed1 = 20 then do; response = 'hit'; speed1 = 0.35; end;
      else delete; end;
   if response = 'hit' and speed1 = 20 then speed1 = 19.65;
   if response = 'falsalr' and speed1 = 20 then speed1 = 19.65;
proc sort; by sub;
proc transpose data=prac prefix=freq name=name out=freq; by sub; run;
proc sort; by name; run;
data prac; set freq;
   pbbgbd66 = freq1/20; pbHbgbd6 = 1-freq2/20;
   pbbgbd83 = freq3/20; pbHbgbd8 = 1-freq4/20;
   pbbggd66 = freq5/20; pbHbggd6 = 1-freq6/20;
   pbbggd83 = freq7/20; pbHbggd8 = 1-freq8/20;
   pbftbd66 = freq9/20; pbHftbd6 = 1-freq10/20;
   pbftbd83 = freq11/20; pbHftbd8 = 1-freq12/20;
   pbftgd66 = freq13/20; pbHftgd6 = 1-freq14/20;
   pbftgd83 = freq15/20; pbHftgd8 = 1-freq16/20;
   pnbgbd66 = freq17/20; pnHbgbd6 = 1-freq18/20;
   pnbgbd83 = freq19/20; pnHbgbd8 = 1-freq20/20;
   pnbggd66 = freq21/20; pnHbggd6 = 1-freq22/20;
   pnbggd83 = freq23/20; pnHbggd8 = 1-freq24/20;
   pnftbd66 = freq25/20; pnHftbd6 = 1-freq26/20;
   pnftbd83 = freq27/20; pnHftbd8 = 1-freq28/20;
   pnftgd66 = freq29/20; pnHftgd6 = 1-freq30/20;
   pnftgd83 = freq31/20; pnHftgd8 = 1-freq32/20;

   pb666 = mean(pbbgbd66, pbHbgbd6, pbbggd66, pbHbggd6, pbftbd66, pbHftbd6, pbftgd66, pbHftgd6);
   pb833 = mean(pbbgbd83, pbHbgbd8, pbbggd83, pbHbggd8, pbftbd83, pbHftbd8, pbftgd83, pbHftgd8);
   pn666 = mean(pnbgbd66, pnHbgbd6, pnbggd66, pnHbggd6, pnftbd66, pnHftbd6, pnftgd66, pnHftgd6);
   pn833 = mean(pnbgbd83, pnHbgbd8, pnbggd83, pnHbggd8, pnftbd83, pnHftbd8, pnftgd83, pnHftgd8);

   ybbgbd66 = (freq1+freq2)/40;  ybbgbd83 = (freq3+freq4)/40; 
   ybbggd66 = (freq5+freq6)/40;  ybbggd83 = (freq7+freq8)/40; 
   ybftbd66 = (freq9+freq10)/40;  ybbggd83 = (freq11+freq12)/40; 
   ybftgd66 = (freq13+freq14)/40;  ybbggd83 = (freq15+freq16)/40; 
   ynftbd66 = (freq17+freq18)/40;  ynftbd83 = (freq19+freq20)/40; 
   ynftbd66 = (freq21+freq22)/40;  ynftbd83 = (freq23+freq24)/40; 
   ynftgd66 = (freq25+freq26)/40;  ynftgd83 = (freq27+freq28)/40; 
   ynftgd66 = (freq29+freq30)/40; ynftgd83 = (freq31+freq32)/40; 

   BFbgbd66 = probit(freq1/20); BHbgbd66 = probit(freq2/20);
   BFbgbd83 = probit(freq3/20); BHbgbd83 = probit(freq4/20);
   BFbggd66 = probit(freq5/20); BHbggd66 = probit(freq6/20);
   BFbggd83 = probit(freq7/20); BHbggd83 = probit(freq8/20);
   BFftbd66 = probit(freq9/20); BHftbd66 = probit(freq10/20);
   BFftbd83 = probit(freq11/20); BHftbd83 = probit(freq12/20);
   BFftgd66 = probit(freq13/20); BHftgd66 = probit(freq14/20);
   BFftgd83 = probit(freq15/20); BHftgd83 = probit(freq16/20);
   NFbgbd66 = probit(freq17/20); NHbgbd66 = probit(freq18/20);
   NFbgbd83 = probit(freq19/20); NHbgbd83 = probit(freq20/20);
   NFbggd66 = probit(freq21/20); NHbggd66 = probit(freq22/20);
   NFbggd83 = probit(freq23/20); NHbggd83 = probit(freq24/20);
   NFftbd66 = probit(freq25/20); NHftbd66 = probit(freq26/20);
   NFftbd83 = probit(freq27/20); NHftbd83 = probit(freq28/20);
   NFftgd66 = probit(freq29/20); NHftgd66 = probit(freq30/20);
   NFftgd83 = probit(freq31/20); NHftgd83 = probit(freq32/20);
   NDbgbd66 = NHbgbd66 - NFbgbd66; NDbggd66 = NHbggd66 - NFbggd66;
   NDftbd66 = NHftbd66 - NFftbd66; NDftgd66 = NHftgd66 - NFftgd66;
   NDbgbd83 = NHbgbd83 - NFbgbd83; NDbggd83 = NHbggd83 - NFbggd83;
   NDftbd83 = NHftbd83 - NFftbd83; NDftgd83 = NHftgd83 - NFftgd83;
   BDbgbd66 = BHbgbd66 - BFbgbd66; BDbggd66 = BHbggd66 - BFbggd66;
   BDftbd66 = BHftbd66 - BFftbd66; BDftgd66 = BHftgd66 - BFftgd66;
   BDbgbd83 = BHbgbd83 - BFbgbd83; BDbggd83 = BHbggd83 - BFbggd83;
   BDftbd83 = BHftbd83 - BFftbd83; BDftgd83 = BHftgd83 - BFftgd83;
   NbgAtt66 = NDbggd66 - NDbgbd66; NftAtt66 = NDftgd66-NDftbd66;
   BbgAtt66 = BDbggd66 - BDbgbd66; BftAtt66 = BDftgd66-BDftbd66;
   NbgAtt83 = NDbggd83 - NDbgbd83; NftAtt83 = NDftgd83-NDftbd83;
   BbgAtt83 = BDbggd83 - BDbgbd83; BftAtt83 = BDftgd83-BDftbd83;
   Nftbg66 = NftAtt66 - NbgAtt66; Bftbg66 = BftAtt66 - BbgAtt66;
   Nftbg83 = NftAtt83 - NbgAtt83; Bftbg83 = BftAtt83 - BbgAtt83;
   Fruit = mean (NftAtt66, BftAtt66, NftAtt83, BftAtt83);
   Bugs = mean(NbgAtt66, BbgAtt66, NbgAtt83, BbgAtt83);
   FrtBgAAT = Fruit-Bugs;
   if mod(sub,2) = 1 then order = 1; else order = 0;

   BFbgbdal = probit((freq1+freq3)/40);  BHbgbdal = probit((freq2+freq4)/40);
   BFbggdal = probit((freq5+freq7)/40);  BHbggdal = probit((freq6+freq8)/40);
   BFftbdal = probit((freq9+freq11)/40); BHftbdal = probit((freq10+freq12)/40);
   BFftgdal = probit((freq13+freq15)/40); BHftgdal = probit((freq14+freq16)/40);
   nFbgbdal = probit((freq17+freq19)/40);  nHbgbdal = probit((freq18+freq20)/40);
   nFbggdal = probit((freq21+freq23)/40);  nHbggdal = probit((freq22+freq24)/40);
   nFftbdal = probit((freq25+freq27)/40); nHftbdal = probit((freq26+freq28)/40);
   nFftgdal = probit((freq29+freq31)/40); nHftgdal = probit((freq30+freq32)/40);
   bDbgbdal = bHbgbdal - bFbgbdal;   bDbggdal = bHbggdal - bFbggdal;
   bDftbdal = bHftbdal - bFftbdal;   bDftgdal = bHftgdal - bFftgdal;
   bFruitAl = bDftgdal - bDftbdal;   bBugsAl = bDbggdal - bDbgbdal;
   nDbgbdal = nHbgbdal - nFbgbdal;   nDbggdal = nHbggdal - nFbggdal;
   nDftbdal = nHftbdal - nFftbdal;   nDftgdal = nHftgdal - nFftgdal;
   nFruitAl = nDftgdal - nDftbdal;   nBugsAl = nDbggdal - nDbgbdal;

   bZbgbd83 = probit(1 - freq1/20); bZbgbd66 = probit(1 - freq3/20);
   nZbgbd83 = probit(1 - freq17/20); nZbgbd66 = probit(1 - freq19/20);
   bZbggd83 = probit(1 - freq5/20); bZbggd66 = probit(1 - freq7/20);
   nZbggd83 = probit(1 - freq21/20); nZbggd66 = probit(1 - freq23/20);
   bZftbd83 = probit(1 - freq9/20); bZftbd66 = probit(1 - freq11/20);
   nZftbd83 = probit(1 - freq25/20); nZftbd66 = probit(1 - freq27/20);
   bZftgd83 = probit(1 - freq13/20); bZftgd66 = probit(1 - freq15/20);
   nZftgd83 = probit(1 - freq29/20); nZftgd66 = probit(1 - freq31/20);

   bZbgbdAl = probit(1 - ((freq1+freq3)/40)); bZbggdal = probit(1 - ((freq5+freq7)/40));
   bZftbdal = probit(1 - ((freq9+freq11)/40)); bZftgdal = probit(1 - ((freq13+freq15)/40));
   nZbgbdAl = probit(1 - ((freq17+freq19)/40)); nZbggdal = probit(1 - ((freq21+freq23)/40));
   nZftbdal = probit(1 - ((freq25+freq27)/40)); nZftgdal = probit(1 - ((freq29+freq31)/40));

   bBbgbd83 = probnorm(bZbgbd83 - bDbgbd83)/probnorm(bZbgbd83);
   nBbgbd83 = probnorm(nZbgbd83 - nDbgbd83)/probnorm(nZbgbd83);
   bBbgbd66 = probnorm(bZbgbd66 - bDbgbd66)/probnorm(bZbgbd66);
   nBbgbd66 = probnorm(nZbgbd66 - nDbgbd66)/probnorm(nZbgbd66);
   bBbggd83 = probnorm(bZbggd83 - bDbggd83)/probnorm(bZbggd83);
   nBbggd83 = probnorm(nZbggd83 - nDbggd83)/probnorm(nZbggd83);
   bBbggd66 = probnorm(bZbggd66 - bDbggd66)/probnorm(bZbggd66);
   nBbggd66 = probnorm(nZbggd66 - nDbggd66)/probnorm(nZbggd66);
   bBftbd83 = probnorm(bZftbd83 - bDftbd83)/probnorm(bZftbd83);
   nBftbd83 = probnorm(nZftbd83 - nDftbd83)/probnorm(nZftbd83);
   bBftbd66 = probnorm(bZftbd66 - bDftbd66)/probnorm(bZftbd66);
   nBftbd66 = probnorm(nZftbd66 - nDftbd66)/probnorm(nZftbd66);
   bBftgd83 = probnorm(bZftgd83 - bDftgd83)/probnorm(bZftgd83);
   nBftgd83 = probnorm(nZftgd83 - nDftgd83)/probnorm(nZftgd83);
   bBftgd66 = probnorm(bZftgd66 - bDftgd66)/probnorm(bZftgd66);
   nBftgd66 = probnorm(nZftgd66 - nDftgd66)/probnorm(nZftgd66);

   bBbgbdal = probnorm(bZbgbdal - bDbgbdal)/probnorm(bZbgbdal);
   bBbggdal = probnorm(bZbggdal - bDbggdal)/probnorm(bZbggdal);
   bBftbdal = probnorm(bZftbdal - bDftbdal)/probnorm(bZftbdal);
   bBftgdal = probnorm(bZftgdal - bDftgdal)/probnorm(bZftgdal);
   nBbgbdal = probnorm(nZbgbdal - nDbgbdal)/probnorm(nZbgbdal);
   nBbggdal = probnorm(nZbggdal - nDbggdal)/probnorm(nZbggdal);
   nBftbdal = probnorm(nZftbdal - nDftbdal)/probnorm(nZftbdal);
   nBftgdal = probnorm(nZftgdal - nDftgdal)/probnorm(nZftgdal);

/*   proc means; var pbbgbd66 pbHbgbd6 pbbgbd83 pbHbgbd8 pbbggd66 pbHbggd6
   pbbggd83 pbHbggd8 pbftbd66 pbHftbd6 pbftbd83 pbHftbd8 pbftgd66 pbHftgd6
   pbftgd83 pbHftgd8 pnbgbd66 pnHbgbd6 pnbgbd83 pnHbgbd8 pnbggd66 pnHbggd6
   pnbggd83 pnHbggd8 pnftbd66 pnHftbd6 pnftbd83 pnHftbd8 pnftgd66 pnHftgd6 pnftgd83 pnHftgd8;run;
   proc means; var pb666 pb833 pn666 pn833;run;
   proc means; var ybbgbd66  ybbgbd83 ybbggd66  ybbggd83 ybftbd66  ybbggd83 ybftgd66  ybbggd83 
   ynftbd66  ynftbd83 ynftbd66  ynftbd83  ynftgd66  ynftgd83  ynftgd66  ynftgd83; run;*/

data explicit;
  informat major $25.; informat Afavrte $15.; informat ethnicit $15.;
  infile 'c:/My Documents/data/scAT.2/AAT.explicit.2.dat' delimiter='09'x;
  input #1 sub Afruit Abugs Amath Apsych Aengr Aarts Abiology Areading Ascience Aenglish
            Aphysics Aphil AR1 $ AR2 $ AR3 $ AR4 $ AR5 $ AR6 $ AR7 $ AR8 $ AR9 $ AR10 $
            Afavrte $ BSRI1 BSRI2 BSRI3 BSRI4 BSRI5 BSRI6 BSRI7 BSRI8 BSRI9 BSRI10
            BSRI11 BSRI12 BSRI13 BSRI14 BSRI15 BSRI16 BSRI17 BSRI18 BSRI19 BSRI20
            BSRI21 BSRI22 BSRI23 BSRI24 BSRI25 BSRI26 BSRI27 BSRI28 BSRI29 BSRI30
            BSRI31 BSRI32 BSRI33 BSRI34
        #2  BSRI35 BSRI36 BSRI37 BSRI38 BSRI39 BSRI40
            BSRI41 BSRI42 BSRI43 BSRI44 BSRI45 BSRI46 BSRI47 BSRI48 BSRI49 BSRI50
            BSRI51 BSRI52 BSRI53 BSRI54 BSRI55 BSRI56 BSRI57 BSRI58 BSRI59 BSRI60
            GID1 GID2 GID3 GID3 GID5 GID6 GID7 GID8 GID9 GID10 GID11 GID12 GID13 GID14
            year major $ age sex $ ethnicit $ bornUS UShwlng Engfirst Enghwlng
            glasses handed $ sleep alert computer hrsoncmp comfort Dgender Dage Drace Dses;

data IAT;
  infile 'c:/My Documents/data/AAT.1/IATdata.txt' delimiter='09'x;
  input sub fruitgd fruitbd fruitbug mathgd mathbd mathread;
proc sort; by sub;

proc sort data=explicit; by sub;run;
data comb;merge prac (in=frog) explicit; by sub; if frog;run;
proc sort; by sub;
data comb;merge comb (in=frog) IAT; by sub; if frog; run;
proc sort; by sex sub;run;

data comb;
  set comb;
  masculin = mean (of BSRI1 BSRI4 BSRI7 BSRI10
            BSRI13 BSRI16 BSRI19 BSRI22 BSRI25 BSRI28 BSRI31 BSRI34 BSRI37 BSRI40
            BSRI43 BSRI46 BSRI49 BSRI52 BSRI55 BSRI58);
  feminine = mean (of BSRI2 BSRI5 BSRI8 BSRI11 BSRI14 BSRI17 BSRI20
            BSRI23 BSRI26 BSRI29 BSRI32 BSRI35 BSRI38 BSRI41 BSRI44 BSRI47 BSRI50
            BSRI53 BSRI56 BSRI59);
  neutral  = mean (of BSRI3 BSRI6 BSRI9 BSRI12 BSRI15 BSRI18 BSRI21 BSRI24 BSRI27 BSRI30
            BSRI33 BSRI36 BSRI39 BSRI42 BSRI45 BSRI48 BSRI51 BSRI54 BSRI57 BSRI60);
  GID2 = -GID2; GID4 = -GID4; GID5 = -GID5; GID7 = -GID7; GID9 = -GID9;
  GID11 = -GID11; GID13 = -GID13;
  EgenID = mean(GID1 - GID14);
  Afrtbug = Afruit - Abugs;
  if sub = 25 then do; NDFTBD83 = .; NDFTGD83 = .;end;  if sub = 25 then delete;

/*overall analysis*/
proc means; var bDbgbdal bdbggdal bdftbdal bdftgdal nDbgbdal ndbggdal ndftbdal ndftgdal;run;
proc glm; model bDbgbdal bdbggdal bdftbdal bdftgdal nDbgbdal ndbggdal ndftbdal ndftgdal = /nouni;
          repeated backgrnd 2, bugfruit 2, badgood 2;run;
proc glm; model bDbgbdal bdbggdal = /nouni; repeated badgood 2;title 'bugs only';run;
proc glm; model nDbgbdal nDbggdal = /nouni; repeated badgood 2;title 'bugs only';run;
proc glm; model bDftbdal bDftgdal = /nouni;repeated badgood 2;title 'fruit only';run;
proc glm; model NDftbdal NDftgdal = /nouni;repeated badgood 2;title 'fruit only';run;

proc glm; model NDbgbd66 NDbggd66 NDftbd66 NDftgd66 NDbgbd83 NDbggd83 NDftbd83 NDftgd83
      BDbgbd66 BDbggd66 BDftbd66 BDftgd66 BDbgbd83 BDbggd83 BDftbd83 BDftgd83 = /nouni;
     repeated backgrnd 2, window 2, bugfruit 2, badgood 2;run;

/* sensitivity analysis*/
proc means;
  var NDbgbd66 NDbggd66 NDftbd66 NDftgd66 NDbgbd83 NDbggd83 NDftbd83 NDftgd83
      BDbgbd66 BDbggd66 BDftbd66 BDftgd66 BDbgbd83 BDbggd83 BDftbd83 BDftgd83;run;
/*proc means;
  class order;
  var NDbgbd66 NDbggd66 NDftbd66 NDftgd66 NDbgbd83 NDbggd83 NDftbd83 NDftgd83
      BDbgbd66 BDbggd66 BDftbd66 BDftgd66 BDbgbd83 BDbggd83 BDftbd83 BDftgd83;run;
proc print;var sub NDbgbd66 NDbggd66 NDftbd66 NDftgd66 NDbgbd83 NDbggd83 NDftbd83 NDftgd83;run;
proc print;var sub BDbgbd66 BDbggd66 BDftbd66 BDftgd66 BDbgbd83 BDbggd83 BDftbd83 BDftgd83;run;*/

proc glm; model NDbgbd66 NDbggd66 NDftbd66 NDftgd66 = order /nouni;repeated bugfruit 2, badgood 2;run;
proc glm; model NDbgbd83 NDbggd83 NDftbd83 NDftgd83 = order /nouni;repeated bugfruit 2, badgood 2;run;
proc glm; model BDbgbd66 BDbggd66 BDftbd66 BDftgd66 = order /nouni;repeated bugfruit 2, badgood 2;run;
proc glm; model BDbgbd83 BDbggd83 BDftbd83 BDftgd83 = order /nouni;repeated bugfruit 2, badgood 2;run;

proc glm; model NDbgbd66 NDbggd66 = /nouni;repeated badgood 2;title 'bugs only';run;
proc glm; model NDbgbd83 NDbggd83 = /nouni;repeated badgood 2;title 'bugs only';run;
proc glm; model BDbgbd66 BDbggd66 = /nouni;repeated badgood 2;title 'bugs only';run;
proc glm; model BDbgbd83 BDbggd83 = /nouni;repeated badgood 2;title 'bugs only';run;

proc glm; model NDftbd66 NDftgd66 = /nouni;repeated badgood 2;title 'fruit only';run;
proc glm; model NDftbd83 NDftgd83 = /nouni;repeated badgood 2;title 'fruit only';run;
proc glm; model BDftbd66 BDftgd66 = /nouni;repeated badgood 2;title 'fruit only';run;
proc glm; model BDftbd83 BDftgd83 = /nouni;repeated badgood 2;title 'fruit only';run;

/*bias analysis*/
proc means; var bbbgbdal bbbggdal bbftbdal bbftgdal nbbgbdal nbbggdal nbftbdal nbftgdal;run;
proc glm; model bbbgbdal bbbggdal bbftbdal bbftgdal nbbgbdal nbbggdal nbftbdal nbftgdal = /nouni;
          repeated backgrnd 2, bugfruit 2, badgood 2;run;
proc glm; model bbbgbdal bbbggdal = /nouni; repeated badgood 2;title 'bugs only';run;
proc glm; model nbbgbdal nbbggdal = /nouni; repeated badgood 2;title 'bugs only';run;
proc glm; model bbftbdal bbftgdal = /nouni;repeated badgood 2;title 'fruit only';run;
proc glm; model Nbftbdal Nbftgdal = /nouni;repeated badgood 2;title 'fruit only';run;

proc glm; model Nbbgbd66 Nbbggd66 Nbftbd66 Nbftgd66 Nbbgbd83 Nbbggd83 Nbftbd83 Nbftgd83
      Bbbgbd66 Bbbggd66 Bbftbd66 Bbftgd66 Bbbgbd83 Bbbggd83 Bbftbd83 Bbftgd83 = /nouni;
     repeated backgrnd 2, window 2, bugfruit 2, badgood 2;run;
proc means;
  var Nbbgbd66 Nbbggd66 Nbftbd66 Nbftgd66 Nbbgbd83 Nbbggd83 Nbftbd83 Nbftgd83
      Bbbgbd66 Bbbggd66 Bbftbd66 Bbftgd66 Bbbgbd83 Bbbggd83 Bbftbd83 Bbftgd83;run;

proc glm; model Nbbgbd66 Nbbggd66 = /nouni;repeated badgood 2;title 'bugs only';run;
proc glm; model Nbbgbd83 Nbbggd83 = /nouni;repeated badgood 2;title 'bugs only';run;
proc glm; model Bbbgbd66 Bbbggd66 = /nouni;repeated badgood 2;title 'bugs only';run;
proc glm; model Bbbgbd83 Bbbggd83 = /nouni;repeated badgood 2;title 'bugs only';run;

proc glm; model Nbftbd66 Nbftgd66 = /nouni;repeated badgood 2;title 'fruit only';run;
proc glm; model Nbftbd83 Nbftgd83 = /nouni;repeated badgood 2;title 'fruit only';run;
proc glm; model Bbftbd66 Bbftgd66 = /nouni;repeated badgood 2;title 'fruit only';run;
proc glm; model Bbftbd83 Bbftgd83 = /nouni;repeated badgood 2;title 'fruit only';run; 




/*
proc corr; var fruitbug mathread fruitgd fruitbd Nftbg66 Bftbg66 Nftbg83 Bftbg83 FrtBgAAT;
proc corr; var NftAtt66 BftAtt66 NftAtt83 BftAtt83 Fruit NbgAtt66 BbgAtt66 NbgAtt83 BbgAtt83 Bugs;
           with fruitbug mathread fruitgd fruitbd;run;
proc print; var sub fruitbug fruitgd fruitbd Nftbg66 Bftbg66 Nftbg83 Bftbg83 FrtBgAAT ;
proc print; var NftAtt66 BftAtt66 NftAtt83 BftAtt83 Fruit NbgAtt66 BbgAtt66 NbgAtt83 BbgAtt83 Bugs;run;
*/

/*
proc corr; var NbgAtt66 NbgAtt83 BbgAtt66 BbgAtt83 NftAtt66 NftAtt83 BftAtt66 BftAtt83;run;
proc corr; var Afrtbug Afruit Abugs;
  with NbgAtt66 NbgAtt83 BbgAtt66 BbgAtt83 NftAtt66 NftAtt83 BftAtt66 BftAtt83;run;
*/
